package utils;

import java.sql.Connection;
import java.sql.DriverManager;

public class JDBC {
    public static void main(String[] args) {
        String url = "jdbc:mysql://127.0.0.1:3306/chatroom?useSSL=false";
        String user= "root";
        String password = "111111";
        try{
            Class.forName("com.mysql.jdbc.Driver");
            System.out.println("开始尝试连接数据库……");
            Connection connection = DriverManager.getConnection(url,user,password);
            System.out.println(connection);
            connection.close();
        } catch (Exception e) {
//            System.out.println("执行数据库操作报错！");
            e.printStackTrace();
        }
    }
}
